<template lang="html">
  <section class="components-video-recommends">
    <div class="video_list_content" v-for="item in list" @click="routeTo(item.id)">
      <div class="video_list_content_video">
        <progressive-img :src="item.thumbnail_url" />
      </div>
      <div class="video_list_content_art">
        <h2>{{item.title.length >16 ? item.title.slice(0,16) + '...' : item.title}}</h2>
        <div class="info">
          <p>播放量：{{item.total_views}}</p>
          <p>上传时间：{{item.created_at.split(' ')[0]}}</p>
        </div>
      </div>
      <div class="video_list_content_remain">
        <span v-if="!item.hasBought">{{item.price == 0 ? '免费': '￥' + parseInt(item.price, 10)*0.01}}</span>
        <span v-else>已购买</span>
        <div class="video_list_content_remain_tri"></div>
        <div class="video_list_content_remain_triright"></div>
      </div>
      <div class="video_list_cover"></div>
    </div>
  </section>
</template>

<script>
export default {
  props: {
    list: {
      type: Array
    }
  },
  methods: {
    routeTo(id){
      this.$router.push({ path: `/video/${id}` })
    }
  }
}
</script>

<style lang="scss" scoped>
@import "../../css/config";
$video-poster-width: 245px;
.components-video-recommends{
  width: 100%;
  margin-top: 33px;
  .video_list_content{
    width: 100%;
    height: 180px;
    padding: 20px 101px 20px 72px+$video-poster-width+35px;
    box-sizing: border-box;
    display: flex;
    position: relative;
    flex-direction: row;
    background: #fff;
    border-bottom: 2px solid #858585;
    .video_list_content_video{
      position: absolute;
      top: 50%;
      left: 72px;
      transform: translateY(-50%);
      width: 245px;
      height: 135px;
      background: #333333;
      img{
        display: block;
        width: 100%;
      }
    }
    .video_list_content_art{
      width: 100%;
      height: 100%;
      // padding-left: 35px;
      display: flex;
      flex-direction:column ;
      justify-content: space-between;
      h2{
        font-size: 30px;
        line-height: 36px;
        max-height: 72px;
        overflow: hidden;
      }
      .info{
        width: 120%;
        p{
          font-size: 24px;
          color: #a6a6a6;
          line-height: 30px;
          @include text-overflow;
        }
      }
    }
  .video_list_content_remain{
    width: 66px;
    background: #ff4907;
    text-align: center;
    line-height: 36px;
    color: #fff;
    font-size: 18px;
    letter-spacing: 2px;
    position: absolute;
    top: 0;
    right: 21px;
    white-space: nowrap;
    text-overflow: ellipsis;
      .video_list_content_remain_tri{
        position: absolute;
        bottom: -25px;
        left: 0;
        width: 0;
        height: 0;
        border-left: 0 solid transparent;
        border-right: 50px solid transparent;
        border-top: 28px solid #ff4907;
      }
      .video_list_content_remain_triright{
        position: absolute;
        bottom: -25px;
        right: 0;
        /*margin-top: 22px;*/
        width: 0;
        height: 0;
        border-left: 50px solid transparent;
        border-right: 0 solid transparent;
        border-top: 28px solid #ff4907;
      }
    }
  }
}
</style>
